Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF cache FFTs of various quantities #216

Merged
merged 8 commits into from
Jun 21, 2022
Merged

PERF cache FFTs of various quantities #216

merged 8 commits into from
Jun 21, 2022

Conversation

beckermr
Copy link
Collaborator

@beckermr beckermr commented Mar 18, 2022

This PR adds caching of FFTs of various images in order to speed up the code.

@beckermr beckermr changed the title TST added test for speed of prepsf moments PERF cache FFTs of various quantities Apr 11, 2022
@beckermr beckermr marked this pull request as ready for review April 29, 2022 11:58
@beckermr beckermr requested a review from esheldon April 29, 2022 11:58
@beckermr
Copy link
Collaborator Author

This one is ready for review @esheldon!

Copy link
Owner

@esheldon esheldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have a speedup test for metacal, asserting it is faster by X, to justify the change.

ngmix/tests/test_prepsfmom.py Outdated Show resolved Hide resolved
@beckermr
Copy link
Collaborator Author

beckermr commented Apr 29, 2022

The speedup for the pre-PSF moments is a factor of 2 from ~10ms to ~5ms. This assumes you have the same PSF which is, in general, true for metadetect measurements.

@esheldon
Copy link
Owner

esheldon commented May 2, 2022

what about for metacal? Is there an important and predictable speedup for this caching?

@beckermr
Copy link
Collaborator Author

beckermr commented May 2, 2022

I did not put in the test yet sorry. In my measurements for running color-dependent metadetection, it was ~30% or so.

@beckermr
Copy link
Collaborator Author

beckermr commented May 2, 2022

The speedup comes from caching the galsim interpolated image object of the original image. Its FFT gets cached internally by galsim and this saves a bunch of time in generating the different metacal images at each color.

@beckermr
Copy link
Collaborator Author

I need to increase the digits on the jacobian repr for this one.

@beckermr
Copy link
Collaborator Author

ok @esheldon This PR is ready to go. I added a test showing the ~30% gains from caching for mdet-sized images.

@beckermr beckermr merged commit 0b90f27 into master Jun 21, 2022
@beckermr beckermr deleted the test-for-speed branch June 21, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants